﻿Imports System.IO
Imports System.Reflection
Imports System.Drawing
Imports System.Runtime.Serialization

Module Testing
    Public Class ToBeTester
        Public Field1 = "String1"
        Public Field2 = "String2"
        Public Property Prop1 = 999
        Public Num = Me
    End Class
    Sub Main()
        Dim s As New CompilerInfo
        s.AddProviders({New BooleanTypeProvider,
                        New ValueTypesProvider,
                        New StringTypeProvider,
                        New CollectionTypesProvider,
                        New ObjectTypeProvider})
        Using sw As New StringWriter, sx As New StateWriter(s)
            sx.WriteState(New ToBeTester, sw)
            File.WriteAllText("Main.txt", sw.ToString)
            Using sr As New StringReader(sw.ToString), sd As New StateReader(s)
                Dim obj = sd.ReadState(sr)
            End Using
        End Using
    End Sub
    Sub Say(Txt As String)
        Console.WriteLine(Txt)
    End Sub
    
End Module